package gqqnbig;

public class Tuple<T1, T2>
{
	public final T1 item1;
	public final T2 item2;

	public Tuple(T1 item1, T2 item2)
	{
		this.item1 = item1;
		this.item2 = item2;
	}

	@Override
	public String toString()
	{
		return "(" + item1 + "," + item2 + ")";
	}

	@Override
	public boolean equals(Object other)
	{
		if (other == null)
		{
			return false;
		}
		if (other == this)
		{
			return true;
		}
		if (!(other instanceof Tuple))
		{
			return false;
		}
		Tuple<T1, T2> other_ = (Tuple<T1, T2>) other;
		return other_.item1 == this.item1 && other_.item2 == this.item2;
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((item1 == null) ? 0 : item1.hashCode());
		result = prime * result + ((item2 == null) ? 0 : item2.hashCode());
		return result;
	}
}